import 'package:flutter/material.dart';
import 'package:flutter_study/pages/getx/controllers/count_controller.dart';
import '../routers/routers.dart';
import 'package:get/get.dart';
import 'package:flutter/rendering.dart'; // 注意要导入
import '../routers/getx_routers.dart';

final GlobalKey<NavigatorState> myAppNavigatorKey = GlobalKey<NavigatorState>();
void main() {
  // 开启调试布局边界
  //debugPaintSizeEnabled = true;
  Get.put(GetXCountController());
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      navigatorKey: myAppNavigatorKey, // 唯一命名
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        useMaterial3: true,
        colorScheme: ColorScheme.fromSeed(
          seedColor: Colors.blue, // 默认蓝色
          brightness: Brightness.light, // 默认浅色
        ),
        appBarTheme: AppBarTheme( // 默认深色
          backgroundColor: Colors.blue,
          foregroundColor: Colors.white,
          elevation: 0.0,// 阴影
        ),
      ),
      ///home: HomePage(),
      initialRoute: '/',

      ///普通路由配置
      //onGenerateRoute: onGenerateRoute,

      ///GetX路由配置
      defaultTransition: Transition.leftToRight,
      getPages: RouterPage.routes,
    );
  }
}

// class HomePage extends StatefulWidget {
//   const HomePage({super.key});
//
//   @override
//   State<HomePage> createState() => _HomePageState();
// }
//
// class _HomePageState extends State<HomePage>
//     with SingleTickerProviderStateMixin {
//   late TabController _tabController;
//
//   // Initialize the TabController
//   @override
//   void initState() {
//     super.initState();
//     _tabController = TabController(length: 4, vsync: this);
//   }
//
//   @override
//   Widget build(BuildContext context) {
//     return Tabs();
//   }
// }
